package presenters.component

import java.text.MessageFormat

class ErrorsComponent {

    def static namespace = "gp"

    def renderErrorsFor = {bean ->
        if (bean) {
            builder.ul {
                bean.errors.each {errors ->
                    errors.allErrors.each {
                        println(it)
                        li(MessageFormat.format(it.getDefaultMessage(), it.getArguments()))
                    }
                }
            }
        }
    }

}